package day11;
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class learn4 {
    public static void main(String[] args) throws IOException {
        int suzu[]=new int[10];
        //循环控制随机数的产生
        for(int i=0;i<suzu.length;i++){
            suzu[i]=(int)(Math.random()*10);
        }
        int temp;
        //正序
    Arrays.sort(suzu);
        String str=Arrays.toString(suzu);
        //创建文件
        File file2=new File("D:\\WUDownloadCache\\te1.txt");
        file2.createNewFile();
        //写入文件
        try{
            String str1=str;
            byte[] words= str1.getBytes();
            //写入流
          FileOutputStream fileOutputStream=new FileOutputStream(file2);
          fileOutputStream.write(words);
          //读出流
          FileInputStream fileInputStream=new FileInputStream(file2);
          //读取文件
            while((temp=fileInputStream.read())!=-1){
                System.out.print((char) temp+"");
            }
            fileOutputStream.close();
            fileInputStream.close();
        }catch (Exception e){
            e.printStackTrace();

        }finally {
System.out.println("************");
System.out.println("有异常出现");
        }
    }
}





